﻿
@{
    ViewBag.Title = "MyCalendarEdit";
}
<link href="/Static/styles/bootstrap.min.css" rel="stylesheet" />
<link type="text/css" rel="stylesheet" href="/Static/js/layui/css/layui.css" />
<link href="/Static/js/layer/need/layer.css" rel="stylesheet" />
<link href="/Static/js/calendar/zui.calendar.min.css" rel="stylesheet" />
<script src="/Static/js/jquery/jquery-1.11.1.min.js"></script>
<script src="/Static/js/layui/layui.js"></script>
<script src="/Static/js/zui/zui.min.js"></script>
<script src="/Static/js/calendar/zui.calendar.min.js"></script>
<script src="/Static/js/layer/layer.js"></script>
<script src="/Static/js/layer/layer.tools.js"></script>
<div class="modal-body">

    <script>
        var simple =
            ['formatblock', 'fontsize', '|', 'bold', 'italic', 'underline', '|',
                'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist', '|',
                'emoticons', 'image', 'link', '|', 'removeformat', 'undo', 'redo'];

        var full =
            ['formatblock', 'fontsize', 'lineheight', '|', 'forecolor', 'hilitecolor', '|', 'bold', 'italic', 'underline', 'strikethrough', '|',
                'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', '|',
                'insertorderedlist', 'insertunorderedlist', '|',
                'emoticons', 'image', 'insertfile', 'hr', '|', 'link', 'unlink', '/',
                'undo', 'redo', '|', 'cut', 'copy', 'paste', '|', 'plainpaste', 'wordpaste', '|', 'removeformat', 'clearhtml', 'quickformat', '|',
                'indent', 'outdent', 'subscript', 'superscript', '|',
                'table', 'code', '|', 'pagebreak', 'anchor', '|',
                'fullscreen', 'source', 'about'];

        $(document).ready(initKindeditor);
        function initKindeditor(afterInit) {
            $(':input[type=submit]').after("<input type='hidden' id='uid' name='uid' value=" + v.uid + ">");

            var nextFormControl = 'input:not([type="hidden"]), textarea:not(.ke-edit-textarea), button[type="submit"], select';
            $.each(v.editors.id, function (key, editorID) {
                if (typeof (v.editors.filterMode) == 'undefined') v.editors.filterMode = true;
                editorTool = eval(v.editors.tools);
                var K = KindEditor, $editor = $('#' + editorID);
                var options =
                {
                    cssPath: [v.themeRoot + 'zui/css/min.css'],
                    width: '100%',
                    items: editorTool,
                    filterMode: true,
                    bodyClass: 'article-content',
                    urlType: 'absolute',
                    uploadJson: createLink('file', 'ajaxUpload', 'uid=' + v.uid),
                    fileManagerJson: createLink('file', 'fileManager'),
                    imageTabIndex: 1,
                    filterMode: v.editors.filterMode,
                    allowFileManager: true,
                    langType: v.editorLang,
                    afterBlur: function () { this.sync(); },
                    afterChange: function () { $editor.change().hide(); },
                    afterCreate: function () {
                        var doc = this.edit.doc;
                        var cmd = this.edit.cmd;
                        if (!K.WEBKIT && !K.GECKO) {
                            var pasted = false;
                            $(doc.body).bind('paste', function (ev) {
                                pasted = true;
                                return true;
                            });
                            setTimeout(function () {
                                $(doc.body).bind('keyup', function (ev) {
                                    if (pasted) {
                                        pasted = false;
                                        return true;
                                    }
                                    if (ev.keyCode == 86 && ev.ctrlKey) alert('您的浏览器不支持粘贴图片！');
                                })
                            }, 10);
                        }
                        /* Paste in chrome.*/
                        /* Code reference from http://www.foliotek.com/devblog/copy-images-from-clipboard-in-javascript/. */
                        if (K.WEBKIT) {
                            $(doc.body).bind('paste', function (ev) {
                                var $this = $(this);
                                var original = ev.originalEvent;
                                var file = original.clipboardData.items[0].getAsFile();
                                if (file) {
                                    var reader = new FileReader();
                                    reader.onload = function (evt) {
                                        var result = evt.target.result;
                                        var result = evt.target.result;
                                        var arr = result.split(",");
                                        var data = arr[1]; // raw base64
                                        var contentType = arr[0].split(";")[0].split(":")[1];

                                        html = '<img src="' + result + '" alt="" />';
                                        $.post(createLink('file', 'ajaxPasteImage', 'uid=' + v.uid), { editor: html }, function (data) {
                                            if (data) return cmd.inserthtml(data);

                                            alert(v.errorUnwritable);
                                            return cmd.inserthtml(html);
                                        });
                                    };
                                    reader.readAsDataURL(file);
                                }
                            });
                        }
                        /* Paste in firfox and other firfox.*/
                        else {
                            $(doc.body).bind('paste', function (ev) {
                                setTimeout(function () {
                                    var html = K(doc.body).html();
                                    if (html.search(/<img src="data:.+;base64,/) > -1) {
                                        $.post(createLink('file', 'ajaxPasteImage', "uid=" + v.uid), { editor: html }, function (data) {
                                            if (data) return K(doc.body).html(data);

                                            alert(v.errorUnwritable);
                                            return K(doc.body).html(data);
                                        });
                                    }
                                }, 80);
                            });
                        }
                        /* End */
                    },
                    afterTab: function (id) {
                        var $next = $editor.next(nextFormControl);
                        if (!$next.length) $next = $editor.parent().next().find(nextFormControl);
                        if (!$next.length) $next = $editor.parent().parent().next().find(nextFormControl);
                        $next = $next.first().focus();
                        var keditor = $next.data('keditor');
                        if (keditor) keditor.focus();
                        else if ($next.hasClass('chosen')) $next.trigger('chosen:activate');
                    }
                };
                try {
                    if (!window.editor) window.editor = {};
                    var keditor = K.create('#' + editorID, options);
                    window.editor['#'] = window.editor[editorID] = keditor;
                    $editor.data('keditor', keditor);
                }
                catch (e) { }
            });

            if ($.isFunction(afterInit)) afterInit();
        }
    </script>
    <div class="container mw-700px">
        <div class="row-table">
            <div class="col-main">
                <div class="main">
                    <fieldset>
                        <legend>
                            描述
                        </legend>
                        <div>
                            自定义的
                        </div>
                    </fieldset>
                    <script src="/js/jquery/reverseorder/raw.js" type="text/javascript"></script>

                    <style>
                        .wordwrap {
                            word-wrap: break-word;
                            word-break: break-all;
                        }
                    </style>


                    <div class="panel panel-history">
                        <div class="panel-heading">
                            <strong>历史记录</strong>
                            <div class="panel-actions">
                                <span class="btn btn-mini sorter hand"> <span title="切换顺序" class="log-asc"></span></span>
                                <span class="btn btn-mini toggle-all change-show hand" title="切换显示"></span>
                            </div>
                        </div>
                        <div class="panel-body">
                            <ol>
                                <li value="1">
                                    <span>
                                        2018-04-16 18:27:32, 由 <strong>demo</strong> 创建。
                                    </span>
                                </li>
                                <li value="2">
                                    <span>
                                        2018-04-16 18:27:32, 由 <strong>demo</strong> 指派给 <strong>雷磊磊</strong>。
                                    </span>
                                </li>
                            </ol>
                        </div>
                    </div>
                    <script language="Javascript">
                        $(document).ready(function () {
                            $('.finishDating').click(function () {
                                var url = $(this).attr('href');
                                bootbox.confirm(v.lang.confirmFinish, function (result) {
                                    if (result) {
                                        $.getJSON(url, function (response) {
                                            location.reload();
                                        });
                                    }
                                });
                                return false;
                            });

                            /* Toggle one comment. */
                            $('.toggle').click(function () {
                                $(this).toggleClass('change-show').toggleClass('change-hide');
                                if ($(this).parent().next().find('.changes').size()) {
                                    $(this).parent().next().find('.changes').toggle();
                                }
                                else {
                                    $(this).parent().next().toggle().find('.changes').show();
                                }
                            });

                            /* Toggle all comment. */
                            $('.toggle-all').click(function () {
                                $(this).toggleClass('change-show').toggleClass('change-hide');
                                $('.toggle').click();
                            });

                            /* Sort records. */
                            $('.sorter').click(function () {
                                var orderClass = $(this).find('span').attr('class');

                                if (orderClass == 'log-asc') {
                                    $(this).find('span').attr('class', 'log-desc');
                                    $.cookie('historyOrder', 'log-desc', { path: v.webRoot });
                                }
                                else {
                                    $(this).find('span').attr('class', 'log-asc');
                                    $.cookie('historyOrder', 'log-asc', { path: v.webRoot });
                                }

                                $(this).parents('.panel').find('.panel-body li').reverseOrder();
                            });
                            customeHistoryOrder();

                            $('.pager').find('a').click(function () {
                                $('#actionBox').load($(this).attr('href'));
                                return false;
                            });
                        });

                        function customeHistoryOrder() {
                            var historyOrder = $.cookie('historyOrder');
                            if (typeof (historyOrder) == 'undefined') return true;

                            $('.panel-history').each(function () {
                                if (historyOrder != $(this).find('.sorter').find('span').attr('class')) {
                                    $(this).find('.sorter').click();
                                }
                            });
                        }

                        function toggleComment(actionID) {
                            $('.comment' + actionID).toggle();
                            $('#lastCommentBox').toggle();
                            $('.ke-container').css('width', '100%');
                        }

                    </script>
                </div>
                <div class="text-center actions">
                    <span class="self">
                        <a href="/sys/index.php?m=todo&amp;f=finish&amp;id=4" data-id="4" class="btn btn-success ajaxFinish ">完成</a>
                        <a href="/sys/index.php?m=todo&amp;f=assignTo&amp;id=4" data-id="4" class="btn ajaxAssign ">指派</a>
                        <a href="/sys/index.php?m=todo&amp;f=edit&amp;todoID=4" class="btn ajaxEdit ">编辑</a>
                        <a href="/sys/index.php?m=todo&amp;f=activate&amp;id=4" data-id="4" data-toggle="ajax" class="btn disabled">激活</a>
                        <a href="/sys/index.php?m=todo&amp;f=close&amp;id=4" data-id="4" data-toggle="ajax" class="btn disabled">关闭</a>
                        <a href="/sys/index.php?m=todo&amp;f=delete&amp;todoID=4" class="btn todoDeleter ">删除</a>
                    </span>
                    <a href="#commentBox" class="btn" onclick="setComment()">备注</a>
                </div>
                <fieldset id="commentBox" class="hide" style="display: block;">
                    <legend>备注</legend>
                    <form id="ajaxForm" method="post" action="/sys/index.php?m=todo&amp;f=edit&amp;todoID=4&amp;comment=true">
                        <div class="form-group">
                            <div class="ke-container ke-container-default" style="width: 100%;"><div style="display:block;" class="ke-toolbar" unselectable="on"><span class="ke-outline" data-name="formatblock" title="段落" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-formatblock" unselectable="on"></span></span><span class="ke-outline" data-name="fontsize" title="文字大小" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-fontsize" unselectable="on"></span></span><span class="ke-inline-block ke-separator"></span><span class="ke-outline" data-name="bold" title="粗体(Ctrl+B)" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-bold" unselectable="on"></span></span><span class="ke-outline" data-name="italic" title="斜体(Ctrl+I)" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-italic" unselectable="on"></span></span><span class="ke-outline" data-name="underline" title="下划线(Ctrl+U)" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-underline" unselectable="on"></span></span><span class="ke-inline-block ke-separator"></span><span class="ke-outline" data-name="justifyleft" title="左对齐" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-justifyleft" unselectable="on"></span></span><span class="ke-outline" data-name="justifycenter" title="居中" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-justifycenter" unselectable="on"></span></span><span class="ke-outline" data-name="justifyright" title="右对齐" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-justifyright" unselectable="on"></span></span><span class="ke-outline" data-name="insertorderedlist" title="编号" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-insertorderedlist" unselectable="on"></span></span><span class="ke-outline" data-name="insertunorderedlist" title="项目符号" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-insertunorderedlist" unselectable="on"></span></span><span class="ke-inline-block ke-separator"></span><span class="ke-outline" data-name="emoticons" title="插入表情" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-emoticons" unselectable="on"></span></span><span class="ke-outline" data-name="image" title="图片" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-image" unselectable="on"></span></span><span class="ke-outline" data-name="link" title="超级链接" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-link" unselectable="on"></span></span><span class="ke-inline-block ke-separator"></span><span class="ke-outline" data-name="removeformat" title="删除格式" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-removeformat" unselectable="on"></span></span><span class="ke-outline" data-name="undo" title="后退(Ctrl+Z)" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-undo" unselectable="on"></span></span><span class="ke-outline" data-name="redo" title="前进(Ctrl+Y)" unselectable="on"><span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-redo" unselectable="on"></span></span></div><div style="display: block; height: 100px;" class="ke-edit"><iframe class="ke-edit-iframe" hidefocus="true" frameborder="0" tabindex="" style="width: 100%; height: 100px;"></iframe><textarea class="ke-edit-textarea" hidefocus="true" tabindex="" style="width: 100%; height: 100px; display: none;"></textarea></div><div class="ke-statusbar"><span class="ke-inline-block ke-statusbar-center-icon"></span><span class="ke-inline-block ke-statusbar-right-icon"></span></div></div><textarea name="comment" id="comment" rows="5" class="w-p100" style="display: none;"></textarea>
                        </div>
                        <button type="submit" id="submit" class="btn btn-primary" data-loading="稍候...">保存</button><input type="hidden" id="uid" name="uid" value="5ad47cab459c7">
                    </form>
                </fieldset>
            </div>
            <div class="col-side" style="width:300px;">
                <div class="main main-side">
                    <fieldset>
                        <legend>基本信息</legend>
                        <table class="table table-data table-condensed table-borderless">
                            <tbody>
                                <tr>
                                    <th>优先级</th>
                                    <td>最高</td>
                                </tr>
                                <tr>
                                    <th>状态</th>
                                    <td class="todo-wait">未开始</td>
                                </tr>
                                <tr>
                                    <th>类型</th>
                                    <td>自定义</td>
                                </tr>
                                <tr>
                                    <th class="w-80px">日期</th>
                                    <td>2018-04-16</td>
                                </tr>
                                <tr>
                                    <th style="color:red;">起止时间</th>
                                    <td>18:30 ~ 19:00</td>
                                </tr>
                                <tr>
                                    <th class="w-80px">所有者</th>
                                    <td>demo</td>
                                </tr>
                                <tr>
                                    <th class="w-80px">由谁指派</th>
                                    <td>demo</td>
                                </tr>
                                <tr>
                                    <th class="w-80px">指派给</th>
                                    <td>雷磊磊 于 2018-04-16 18:27:32</td>
                                </tr>
                                <tr>
                                    <th class="w-80px">完成者</th>
                                    <td></td>
                                </tr>
                                <tr>
                                    <th class="w-80px">关闭者</th>
                                    <td></td>
                                </tr>
                            </tbody>
                        </table>
                    </fieldset>
                </div>
            </div>
        </div>
    </div>
</div>